#pragma once
#ifndef FOLLOWS_H
#define FOLLOWS_H

#include "spa_types.h"
#include <map>
#include <vector>
#include <algorithm>

class Follows
{

public:

	Follows();
	~Follows();

	/*
	 Assertion:
	   Because Follows DE do not allow for duplicate associations, this insert operation checks 
	   for each association inserted whether the same association exists already, if so, the 
	   association is not inserted and the DE is not changed in any way.
	*/
	void InsertFollows(const STMT statement_1, const STMT statement_2);

	/*
	 Returns:
	   Not found:	STMT object with statement_number = -1.
	   Found:		STMT object containing the respective details.
	*/
	STMT GetPrevious(const STMT following_statement);
	STMT GetFollowing(const STMT previous_statement);

	/*
	 Returns:
	   Not found:   An empty STMT_ARRAY if there are nothing found, i.e. size() == 0
	   Found:		STMT_ARRAY containing the list of STMTs.
	*/
	STMT_ARRAY RetrieveTransitivePrevious(const STMT following_statement);
	STMT_ARRAY RetrieveTransitiveFollowing(const STMT previous_statement);

private:

	map<STMT, STMT> s1_table;
	map<STMT, STMT> s2_table;
};

#endif